﻿<m:EntityBase
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:m="clr-namespace:Signum.Windows"
    x:Class="Signum.Windows.EntityLine"
    x:Name="me" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="332.993" 
    
    Style="{DynamicResource toolTip}">
	<m:EntityBase.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="../Resources.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</m:EntityBase.Resources>

	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition/>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>
		<Label Content="{Binding Path=LabelText, ElementName=me, Mode=Default}" VerticalContentAlignment="Center" HorizontalAlignment="Left" 
		Target="{Binding ElementName=cc, Mode=OneWay}" MinWidth="{Binding Path=(m:Common.MinLabelWidth), ElementName=me, Mode=OneWay}"
		 Visibility="{Binding ElementName=me, Path=(m:Common.LabelVisible), Converter={x:Static m:Converters.BoolToVisibility}}"/>
		<Border Grid.ColumnSpan="1" Grid.Column="1" Margin="1,1,1,1" Padding="3,0,3,0"  
                SnapsToDevicePixels="True" BorderBrush="{DynamicResource BlueBorder}" 
                BorderThickness="1,1,1,1" CornerRadius="3,3,3,3" Background="{DynamicResource BlueBackground}" 
                x:Name="border" Grid.IsSharedSizeScope="False">
            <Grid>
                <ContentControl 
                    x:Name="cc" Focusable="True" 
                    PreviewKeyDown="cc_PreviewKeyDown" 
                    MouseDoubleClick="cc_MouseDoubleClick" 
                    MouseDown="cc_MouseDown"
                    GotFocus="cc_GotFocus"
                    ContentTemplate="{Binding Path=EntityTemplate, ElementName=me, Mode=Default}" 
                    Content="{Binding Path=Entity, ElementName=me, Mode=OneWay}" 
                    HorizontalContentAlignment="Left" 
                    VerticalContentAlignment="Center"
                    HorizontalAlignment="Stretch" 
                    VerticalAlignment="Stretch" />
                <m:AutoCompleteTextBox 
                    x:Name="autoCompleteTextBox"
                    AutoCompleting="autoCompleteTextBox_AutoCompleting" 
                    Closed="autoCompleteTextBox_Closed"
                    Visibility="Hidden"/>
            </Grid>
            <!--HorizontalContentAlignment="Center"
                VerticalContentAlignment="Center"  />-->
		</Border>
		<StackPanel Orientation="Horizontal" Grid.Column="2" x:Name="buttons">
			<Button Focusable="False" x:Name="btCreate" Click="btCreate_Click" Style="{StaticResource RoundButton}" Content="{StaticResource Create}" ToolTip="{m:Loc Create}"/>
			<Button Focusable="False" x:Name="btFind" Click="btFind_Click" Style="{StaticResource RoundButton}" Content="{StaticResource Find}" ToolTip="{m:Loc Find}"/>
			<Button Focusable="False" x:Name="btView" Click="btView_Click" Style="{StaticResource RoundButton}" Content="{StaticResource View}" ToolTip="{m:Loc View}"/>
			<Button Focusable="False" x:Name="btRemove" Click="btRemove_Click" Style="{StaticResource RoundButton}" Content="{StaticResource Remove}" ToolTip="{m:Loc Remove}"/>
		</StackPanel>
	</Grid>

</m:EntityBase>
